Path To
The Path To command allows you to get the pathname, in the form of either an alias or a string, of some of the standard folders on a startup disk. It also allows you to get the location on disk of the frontmost application.Path To is one of several commands provided by the File Commands
scripting addition.SYNTAX
path to folderOrApplication [ as className ]PARAMETERS
- folderOrApplication
One of these constants:apple menu
apple menu items
control panels
desktop
extensions
preferences
printmonitor
printmonitor documents
trash
startup items
system folder
temporary items
startup disk
frontmost application
- className
- The class identifier
string
. If you omit this parameter, the pathname is returned as an alias.RESULT
An alias by default, or a string if you include the optionalas string
parameter.EXAMPLES
path to control panels --result: alias "Hard Disk:System Folder:Control Panels:"tell application "Scriptable Text Editor" set x to path to it as string end tell --result: "Hard Disk:Scriptable Text Editor"
tell application "Scriptable Text Editor" activate tell application "HyperCard" to activate set x to path to frontmost application end tell return x --result: alias "Hard Disk:Applications:HyperCard"
NOTES
The optionalas
parameter is useful if you send the Path To command to an application on a remote computer. If the pathname is returned as a string, you can use the formfile
nameString to identify the folder or application across the network, and Path To won't actually attempt to locate it until you run the script. If the pathname is returned as an alias and you use it to refer to the folder or application elsewhere in the script, Path To also attempts to locate
the file whenever you modify the script and then attempt to check its syntax
or save it, requiring appropriate access privileges and possibly a password each time.ERRORS